#!/bin/bash
# Written at 2015.05.11 by Kevin 

#crontab -e
#30 0 * * * /root/packages/scripts/delete_log.sh '/root/packages/soa_duang/logs' 'provider.log.' 1
#30 0 * * * /root/packages/scripts/delete_log.sh '/root/packages/soa_demo/logs' 'provider.log.' 1
#30 0 * * * /root/packages/scripts/delete_log.sh '/root/packages/soa_proxy/logs' 'proxy.log.' 1


log_path=${1}
log_file_pattern=${2}
day_num=${3}
find ${log_path}/ -mtime ${day_num} -name ${log_file_pattern}"*" -exec rm -rf {} \;
find ${log_path}/ -daystart -mtime ${day_num} -name ${log_file_pattern}"*" -exec rm -rf {} \;

exit $?
